﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartMeterParamFrame
{
    /// <summary>
    /// 驱动接口
    /// </summary>
    public interface  IDevice
    {
        IApplication UISet { set; }

        /// <summary>
        /// 显示UI
        /// </summary>
        void ShowUI();

        /// <summary>
        /// 获取表位数
        /// </summary>
        int Bws { get; }

        /// <summary>
        /// 总线数量
        /// </summary>
        int BusCount { get; }

        /// <summary>
        /// 线程数量
        /// </summary>
        int ThreadCount { get; }

        /// <summary>
        /// 是不是固定通道（意思就是说是不是188H方式打开一路等于打开几个表位的通道）
        /// </summary>
        bool IsChannnelConst { get; }

        /// <summary>
        /// 发送数据
        /// </summary>
        /// <param name="SendData">发送的数据包</param>
        /// <param name="IsReturn">是否返回</param>
        /// <param name="ChannelNo">通信的表位号</param>
        /// <returns></returns>
        bool SendData(ref byte[] bytData, bool IsReturn, int Bwh);
        /// <summary>
        /// 设备联机
        /// </summary>
        /// <returns></returns>
        bool DeviceLink(out string ErrString);
        /// <summary>
        /// 设备脱机
        /// </summary>
        /// <returns></returns>
        bool DeviceOffLink(out string ErrString);
        /// <summary>
        /// 升源
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        bool PowerOn(float U, out string ErrString);
        /// <summary>
        /// 关源
        /// </summary>
        /// <returns></returns>
        bool PowerOff(out string ErrString);
        /// <summary>
        /// 设置误差板
        /// </summary>
        /// <param name="Bwh">表位号</param>
        /// <param name="IsOpen">是否打开</param>
        void SetWcb(int Bwh, bool IsOpen);

        /// <summary>
        /// 设置误差板
        /// </summary>
        /// <param name="WcbType">选择类型</param>
        /// <param name="IsOpen">是否打开</param>
        void SetWcb(byte WcbType, bool IsOpen);
    }
}
